#ifndef __VOREST_TREE_INFO__
#define __VOREST_TREE_INFO__

#include "../glutil/MeshRenderer.h"

class TreeInfoGUI;

namespace dataengine
{
	/** Class used to store the info of a Vorest tree */
	class VorestTreeInfo
	{
		public:
			/** Unique ID for the tree */
			int treeID() const {return m_treeID;}
			/** Unique ID for the tree species */
			int speciesID() const {return m_speciesID;}
			/** ID for the tree model */
			int modelID() const {return m_modelID;}

			/** Tree position */
			const geom::Point3D& position() const {return m_position;}
			/** Tree base color */
			const geom::Vector3D& color() const {return m_baseColor;}

			/** Voronoi cone diameter */
			float diameter() const {return m_treeDiameter;}
			/** Voronoi cone length */
			float length() const {return m_length;}
			/** Tree rotation */
			float rotation() const {return m_rotation;}
			/** Voronoi cell area */
			float area() const {return m_area;}
			/** I HAVE NO IDEA */
			float treeHeight() const {return m_treeHeight;}
			/** I HAVE NO IDEA */
			float globalHeight() const {return m_globalHeight;}
			/** State of this tree: alive/dead */
			bool isAlive() const {return m_isAlive;}
			/** Retrieves necessary info to display this instance */
			glutil::GLInstanceInfo asGLInstanceInfo() const
			{
				glutil::GLInstanceInfo inf;
				inf.m_location[0] = m_position.v[0]/50.0;
				inf.m_location[2] = m_position.v[1]/50.0;
				inf.m_location[1] = m_position.v[2]/50.0;
				inf.m_rotation[0] = inf.m_rotation[2] = 0;
				inf.m_rotation[1] = m_rotation;
				inf.m_scale = m_treeDiameter/50.0;
				inf.m_instanceID = m_treeID;
				return inf;
			}

		private:
			int m_treeID;				// NUMERO
			geom::Point3D m_position; 	// X, Y, Z (EJE TIEMPO)
			float m_treeDiameter;		// DIAMETRO
			float m_length; 			// LONGITUD (F. DISTANCIA) ---- EIN??
			geom::Vector3D m_baseColor; // ROJO, VERDE, AZUL
			float m_rotation;			// ANGULO
			float m_area; 				// AREA </TD>
			int m_speciesID;			// ESPECIE </TD>
			float m_treeHeight;			// ALTURA (DE LA RAIZ A LA COPA) </TD>
			float m_globalHeight;		// ALTURA (SOBRE EL NIVEL DEL MAR) </TD>
			bool m_isAlive;				// VIVO/MUERTO </TD>
			
			int m_modelID; // Added to support .vib files with multiple tree models

			friend class VorestHtmlReader;
			friend class VorestTreeReader;
			friend class ::TreeInfoGUI;
	};

}
#endif

